home *** CD-ROM | disk | FTP | other *** search
- ;
- ; This module is designed to provide the bank switching interface
- ; when thenet is split into 3 chunks.
- ;
- ; The assumption is that the interrupt bits etc are
- ; stored in rom from 0-115f
- ; level 2, 3 & 4 from 1160-7fff for one page
- ; level 7 from 1160-7fff for the other page
- ;
- ;
- ; Also, define Fremem to define the first free byte in RAM
-
- ; released as thenet x-1j september 1993
- ; heavily modified for PK96 ( 64180 ) and X1J release 4
-
- .64180
- ;
- ; this first section is patched with addresses from the linker
- ; symbol table
- ;
- mainf equ 10e0h ; l7a
- l2tol7 equ 1db8h ; l7a
- fmlink equ 20e1h ; l7a
- notify equ 3ceeh ; l7
- acl_entry equ 4519h ; l7b2
- iswarm equ 4f38h ; l7c
- fvalca equ 5dd9h ; l7u
- arp_add equ 6c92h ; tnl7ip.c
- ;
- l2 equ 10e0h ; l2
- l2timr equ 1a8ch ; l2
- chknoa equ 1d26h ; l2
- newlnk equ 1d78h ; l2
- dsclnk equ 1daah ; l2
- itolnk equ 1e18h ; l2
- sdui equ 265dh ; l2
- cpyidl equ 2ee5h ; l2
- cpyid equ 2f25h ; l2
- dealml equ 2f59h ; l2
- dealmb equ 2f89h ; l2
- dealoc equ 2fbch ; l2
- inithd equ 3003h ; l2
- l2init equ 3041h ; l2
- ;
- l3init equ 3270h ; l3
- l3serv equ 33adh ; l3
- brosrv equ 3b42h ; l3
- chgnod equ 3de2h ; l3
- updnbr equ 46f2h ; l3
- getnei equ 479ah ; l3
- iscall equ 485fh ; l3
- isidnt equ 48aah ; l3
- initl4 equ 4a26h ; l4
- l4serv equ 4ac1h ; l4
- trasrv equ 5340h ; l4
- newcir equ 54f2h ; l4
- discir equ 551ch ; l4
- itocir equ 5583h ; l4
- ipinit equ 5e39h ; ip router
- ipserv equ 5ed0h ; ip router
- ip_mask equ 74fdh ; ip router
- ;
-
- BBR equ 039h+0c0h
- extrn kick_wdog_
- ;
- ;
- global pgflag, 1
-
- cseg
- ;
- ; declare these so the linker causes the pages to call the bank switch
- ; versions
- ;
- public fvalca_
- public fmlink_
- public l2tol7_
- public iswarm_
- public mainf_
- public iscall_
- public initl4_
- public l3init_
- public l3serv_
- public l4serv_
- public brosrv_
- public trasrv_
- public discir_
- public itocir_
- public isidnt_
- public newcir_
- public chgnod_
- public getnei_
- public updnbr_
- public acl_entry_
- public ipinit_
- public ipserv_
- public ip_mask_
-
- public l2init_
- public l2_
- public inithd_
- public cpyid_
- public l2timr_
- public chknoa_
- public dealmb_
- public dsclnk_
- public itolnk_
- public sdui_
- public cpyidl_
- public newlnk_
- public dealoc_
- public dealml_
- public notify_
- public arp_add_
-
- ; the following is just to keep the linker happy
- ;
- public .ovbgn
-
- ; One call for each routine. There are two types of routine.
- ; One with parameters and one without. For space reasons we
- ; use a common routine for each.
- ;
- iswarm_: call kick_wdog_
- call setpag1
- jp iswarm
-
- mainf_:
- ld a,7
- out0 (BBR),a
- ld a,1
- ld (pgflag),a
- jp mainf
-
- initl4_: call setpag2
- jp initl4
-
- l3init_: call setpag2
- jp l3init
-
- l3serv_: call setpag2
- jp l3serv
-
- l4serv_: call setpag2
- jp l4serv
-
- brosrv_: call setpag2
- jp brosrv
-
- trasrv_: call setpag2
- jp trasrv
-
- discir_: call setpag2
- jp discir
-
- newcir_: call setpag2
- jp newcir
-
- l2init_: call setpag2
- jp l2init
-
- l2_: call setpag2
- jp l2
-
- chknoa_: call setpag2
- jp chknoa
-
- dsclnk_: call setpag2
- jp dsclnk
-
- newlnk_: call setpag2
- jp newlnk
-
- ipinit_: call setpag2
- jp ipinit
-
- ipserv_: call setpag2
- jp ipserv
-
- acl_entry_: ld de, 01feh
- call setbsf
- call acl_entry
- jr bankexit1
-
- sdui_: ld de, 02f6h
- call setbsf
- call sdui
- jr bankexit5
-
- cpyidl_: ld de, 02fch
- call setbsf
- call cpyidl
- jr bankexit2
-
- dealoc_: ld de, 02feh
- call setbsf
- call dealoc
- jr bankexit1
-
- dealml_: ld de, 02feh
- call setbsf
- call dealml
- jr bankexit1
-
- notify_: ld de, 01f4h
- call setbsf
- call notify
- jr bankexit6
-
- arp_add_: ld de, 01f4h
- call setbsf
- call arp_add
- jr bankexit6
-
- fvalca_: ld de, 01fch
- call setbsf
- call fvalca
- jr bankexit2
-
- fmlink_: ld de, 01fch
- call setbsf
- call fmlink
- jr bankexit2
-
- l2tol7_: ld de, 01fah
- call setbsf
- call l2tol7
- jr bankexit3
-
- iscall_: ld de, 02feh
- call setbsf
- call iscall
- jr bankexit1
-
- bankexit8: pop de
- bankexit7: pop de
- bankexit6: pop de
- bankexit5: pop de
- bankexit4: pop de
- bankexit3: pop de
- bankexit2: pop de
- bankexit1: pop de
- pop bc
- bankexit0:
- ex (sp),hl ; get previous bankswitch state & save hl
- push af ; save A whilst we do it
- ld a,h
- ld (pgflag),a ; reinstate bankswitch state
- call bankctrl
- pop af ; now reinstate A
- ex (sp),hl ; reinstate hl
- inc sp ; correct the stack pointer
- inc sp
- ret
-
- itocir_: ld de, 02fch
- call setbsf
- call itocir
- jr bankexit2
-
- isidnt_: ld de, 02feh
- call setbsf
- call isidnt
- jr bankexit1
-
- chgnod_: ld de, 02f0h
- call setbsf
- call chgnod
- jr bankexit8
-
- getnei_: ld de, 02fah
- call setbsf
- call getnei
- jr bankexit3
-
- updnbr_: ld de, 02fah
- call setbsf
- call updnbr
- jr bankexit3
-
- inithd_: ld de, 02feh
- call setbsf
- call inithd
- jr bankexit1
-
- cpyid_: ld de, 02fch
- call setbsf
- call cpyid
- jr bankexit2
-
- l2timr_: ld de, 02feh
- call setbsf
- call l2timr
- jr bankexit1
-
- dealmb_: ld de, 02feh
- call setbsf
- call dealmb
- jr bankexit1
-
- itolnk_: ld de, 02fch
- call setbsf
- call itolnk
- jr bankexit2
-
- ip_mask_: ld de, 02fch
- call setbsf
- call ip_mask
- jp bankexit2
- ;
- ; this is the entry routine for calls that take parameters.
- ; It is passed a single parameter in the DE register. D tells
- ; it the bank to switch to ( 1 or 2 ). E tells it how many
- ; bytes of parameter data to copy, so a value of 0xfc would
- ; copy 4 bytes, ie 2 parameters. It is coded as a negative
- ; number to make the code quicker.
- ;
- setbsf: pop hl ; pull return address
- ld a,(pgflag) ; save current bank switch value on stack
- push af
- ld a,d ; get new bank value
- ld (pgflag),a ; and save it as current bank
- call bankctrl ; and switch bank
- ld d,0ffh ; convert E to signed double signed DE
- push bc ; save BC. Reinstate in bankexit().
- ld a,e ; save byte count for copy routine
- ex de,hl ; put byte offset into hl
- add hl,sp ; drop stack pointer this many bytes
- ld sp,hl
- push de ;
- cpl ; make byte count positive in A
- push af ; preserve for byte copy
- add a,7 ; add 7 to step over stacked stuff
- ld e,a
- ld d,0
- ex de,hl
- add hl,de ; hl now pointer to data to be copied
- pop af ; bump count to get it correct
- inc a
- ld b,0
- ld c,a
- ldir ; make a copy of parameters
- .ovbgn: ret
-
- ; The setpag1 and setpag2 routines are used for calls that
- ; do not have parameters. They are used to switch to pages
- ; 1 and 2 respectively
- ;
- setpag1: ld d,1
- jr setpag
- setpag2: ld d,2
- ;
- setpag: pop hl ; get return address off stack
- ld a,(pgflag) ; save bank select info in stack
- push af
- ld a,d ; get desired memory bank select
- ld (pgflag),a
- call bankctrl ; set bank select registers
- ld de,bankexit0
- push de ; simulate a return address of bankexit0()
- jp (hl)
- ;
- ; This routine sets the bank control register.
- ; if A equals 1, set bank 1 ie output a zero to the control bit to
- ; select lower half of eprom.
- ; if A equals 2, ie if bit zero is 0, output a 1 to select upper half
- ;
- ; WARNING - if you change this, also change mainf_ function above
- ;
- extrn DIinc_, decEI_
-
- bankctrl:
- ; push hl
- ; call DIinc_ ; turn off interrupts
- and 1 ; see if bit 0 is set ( bank == 1 or 2 )
- jr nz,bctrl0
- xor a
- jr bctrl1
- bctrl0: ld a,7
- bctrl1: out0 (BBR),a
- ; call decEI_ ; turn on ints - ONLY IF they were on before.
- ; pop hl
- ret
-
- dseg
- ;
- ; record top of RAM
- ;
- extrn _Uend_
- public Fremem_
- Fremem_:
- dw _Uend_
-
- end